//
//  mm_userDefinedCellForPart.m
//  HondaPro_2
//
//  Created by Eric on 13-7-31.
//  Copyright (c) 2013年 glendale. All rights reserved.
//

#import "mm_userDefinedCellForPart.h"

@implementation mm_userDefinedCellForPart

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        
        [self initAllLblsOnCell];
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

//初始化自定义控件
-(void)initAllLblsOnCell
{
    self.arrAllKeys = [NSArray arrayWithObjects:
                       @"STORAGE_CODE",
                       @"PART_NO",
                       @"PART_NAME",
                       @"PART_QUANTITY", nil];
    
    NSDictionary *dicAllLblsRect = [NSDictionary dictionaryWithObjectsAndKeys:
                                    [NSValue valueWithCGRect:CGRectMake(0, 0, 239, 50)],@"STORAGE_CODE",
                                    [NSValue valueWithCGRect:CGRectMake(240, 0, 252, 50)],@"PART_NO",
                                    [NSValue valueWithCGRect:CGRectMake(493, 0, 305, 50)],@"PART_NAME",
                                    [NSValue valueWithCGRect:CGRectMake(798, 0, 124, 50)],@"PART_QUANTITY", nil];
    
    self.dicAllLblsOnCell = [NSMutableDictionary dictionaryWithCapacity:[self.arrAllKeys count]];
    
    for (int i = 0; i<[self.arrAllKeys count]; i++)
    {
        NSString *strKey = [self.arrAllKeys objectAtIndex:i];
        CGRect rect = (CGRect)[[dicAllLblsRect objectForKey:strKey] CGRectValue];
        UILabel *lbl = [[UILabel alloc] initWithFrame:rect];
        lbl.backgroundColor = [UIColor clearColor];
        lbl.textColor = [UIColor darkGrayColor];
        lbl.font = [UIFont systemFontOfSize:16];
        [self.dicAllLblsOnCell setObject:lbl forKey:strKey];
        [self addSubview:lbl];
    }
}

@end
